home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / poolChar.lua < prev    next >
Text File  |  2004-01-29  |  3KB  |  136 lines

  1. -- pool character state machine
  2. beginStateMachine()
  3.     
  4.     onEnter(function(msg)
  5.         print("poolChar enter ------------------------------------------");
  6.         local pool = getStateObjectFromID(msg.sender)
  7.         storeStateObject("pool", pool);
  8.                 
  9.     end )
  10.     
  11.  
  12.     onExit(function(msg)
  13.         print("poolChar exit ------------------------------------------ queue:" .. getParent().getActivityQueueCount());
  14. --        local pool = retrieveStateObject("pool");
  15. --        getParent().unlockActionPoints(pool);
  16. --        getParent().stopAllActivities(pool);        
  17. --        removeStateObject("pool");
  18.  
  19.         unlockAll("pool");        
  20.  
  21.     end )
  22.     
  23.     
  24.     state("sitDown")
  25.     
  26.         onEnter(function(msg)
  27.             --local currentOutfit = getParent().getOutfit();
  28.             if (hasOutfit(getParent(), SWIMMING)) then
  29.                 startAnimation("poolSitDown");
  30.             else
  31.                 setState("undress");
  32.             end
  33.         end )
  34.         
  35.         onMsg("end", function(msg)
  36.             setCurrentPosition();
  37.             if testCancel() then
  38.                 setState("getUp")
  39.             else
  40.                 setState("enter")
  41.             end            
  42.         end )
  43.         
  44.         
  45.     state("undress")
  46.     
  47.         onEnter(function(msg)
  48.             --startAnimation("ausziehen2");
  49.             startAnimation(getChangeOutfitAnim(getParent()));
  50.             sendDelayedMsgThis("underwear", 1600);
  51.         end )
  52.         
  53.         onMsg("underwear", function(msg)
  54.             changeOutfit(getParent(), SWIMMING);
  55.         end )
  56.     
  57.         onMsg("end", function(msg)
  58.             setState("sitDown")
  59.         end )
  60.             
  61.     
  62.     state("enter")
  63.     
  64.         onEnter(function(msg)
  65.             print("enter");
  66.             startAnimation("poolGetIn");
  67.             
  68.             getParent().enableBlobShadow(false);
  69.         end )
  70.         
  71.         onMsg("end", function(msg)
  72.         
  73.             getParent().playSound("splashSoft");
  74.         
  75.             if testCancel() then
  76.                 setCurrentPosition();
  77.                 flipPoseDirection();
  78.                 setState("exit")
  79.             else
  80.                 local pool = retrieveStateObject("pool")
  81.                 setCurrentPosition();
  82.                 flipPoseDirection();
  83.                 enterStateMachine("swimChar.stand");
  84.                 -- start the swimming activity
  85.                 getParent().startActivity("swim", pool);
  86.                 nextAction();
  87.                 -- storeStateObject("pool", pool);
  88.             end            
  89.         end )
  90.         
  91.         onReturn(function(msg)
  92.             setState("exit");
  93.         end )
  94.         
  95.  
  96.  
  97.     state("exit")
  98.     
  99.         onEnter(function(msg)
  100.             print("exit");
  101.             -- replace the current entry in the activity queue by a replace pool action
  102.             local character = this.getParent();
  103.             local pool = retrieveStateObject("pool");
  104.             --character.replaceQueueEntry(0, "pm_exitPool");
  105.             -- stop the activity
  106.             getParent().stopActivity("swim", pool);
  107.             flipPoseDirection();
  108.             getParent().playSound("splashSoft");
  109.             startAnimation("poolGetOut");
  110.             
  111.         end )
  112.         
  113.         onMsg("end", function(msg)
  114.             setCurrentPosition();
  115.             getParent().enableBlobShadow(true);
  116.             setState("getUp");
  117.         end )
  118.         
  119.         
  120.         
  121.     state("getUp")
  122.     
  123.         onEnter(function(msg)
  124.             print("getUp");
  125.             startAnimation("poolStandUp");
  126.         end )
  127.         
  128.         onMsg("end", function(msg)
  129.             setCurrentPosition();
  130.             
  131.             exitStateMachine();
  132.             --exitAndGoAway();
  133.         end )
  134.             
  135.     
  136. endStateMachine()